# Maintainer: Jonas Witschel <diabonas@archlinux.org>
pkgname=tpm2-openssl
pkgver=1.1.1
pkgrel=1
pkgdesc='OpenSSL Provider for Trusted Platform Module 2.0 integration'
arch=('loong64' 'x86_64')
url='https://github.com/tpm2-software/tpm2-openssl'
license=('BSD')
depends=('openssl' 'tpm2-tss' 'libtss2-esys.so' 'libtss2-rc.so' 'libtss2-tctildr.so')
checkdepends=('curl' 'dbus' 'swtpm' 'tpm2-abrmd' 'tpm2-tools')
optdepends=('tpm2-abrmd: user space resource manager')
options=('debug')
source=("$url/releases/download/$pkgver/$pkgname-$pkgver.tar.gz"{,.asc}
        'tpm2-openssl_check.sh')
sha512sums=('be4f114b21d15e6baeb7e756a787619d01f20171e86ebc42ea098c98d59ffd2ba648885b345b9d1a9dc3339199eaa6db8335f039587be338c1126e23349b8812'
            'SKIP'
            '08818eb11a2e4f53a6af3c7e2069b04ff5a4d135414a0f7e0dd316abffd9870432fe7f9cd02a2de2f8c99d89862933c8f4af5c76c68834849defc802511290be')
validpgpkeys=('BB0C68611BD255F10FD1EE94B7900BECDB740A3B'  # Petr Gotthard <petr.gotthard@centrum.cz>
              'B7201FE8031B07AF11F5423C6329CFCB6BE6FD76') # Petr Gotthard <petr.gotthard@centrum.cz>

build() {
	cd "$pkgname-$pkgver"
	./configure --prefix=/usr
	make
}

check() {
	cd "$pkgname-$pkgver"
	dbus-run-session "$srcdir/tpm2-openssl_check.sh"
}

package() {
	cd "$pkgname-$pkgver"
	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}
